<?php
require_once 'Kanedo/Db/Interface.php';
class Kanedo_Db {
	
	/**
	 * Connector fuer die DB
	 *
	 * @var Kanedo_Db_Interface
	 */
	protected $_connector 	= null;
		
	protected $_connect		= false;	

	protected $_ressource	= null;
	
	public function __construct(Kanedo_Db_Interface $connector)
	{
		$this->_connector = $connector;
		try {
			if ($this->_connector->_connect())
			{
				$this->_connect = true;
				$this->_ressource = $this->_connector->getRessource();
			}
		}catch(Kanedo_Db_Exception $e){
			//@todo Fehlerbehandlung
			echo $e->getMessage();
		}
		
	}
	
	public function isConnected()
	{
		return $this->_connect;
	}
	
	public function getRessource()
	{
		return $this->_ressource;
	}
	/**
	 * Fuehrt Query aus 
	 *
	 * @param string $sql
	 * @return SQL Result
	 */
	public function executeQuery($sql)
	{
		return $this->_connector->executeQuery($sql);
	}
	public function fetchAll($result)
	{
		return $this->_connector->fetchAll($result);
	}
	public function escape($string)
	{
		return $this->_connector->escape($string);
	}
}
?>